primitive-types
Class T[]
Method Summary |
List
|
getAt(Collection indices)
Select a List of items from an Object array using a Collection to
identify the indices to be selected.
|
List
|
getAt(Range range)
Support the range subscript operator for an Array
|
List
|
getAt(IntRange range)
|
List
|
getAt(EmptyRange range)
|
List
|
getAt(ObjectRange range)
|
Iterator
|
iterator()
Attempts to create an Iterator for the given object by first
converting it to a Collection.
|
T
|
max()
Adds max() method to Object arrays.
|
T
|
max(Closure closure)
Selects the maximum value found from the Object array
using the closure to determine the correct ordering.
|
T
|
max(Comparator comparator)
Selects the maximum value found from the Object array using the given comparator.
|
T
|
min()
Adds min() method to Object arrays.
|
T
|
min(Comparator comparator)
Selects the minimum value found from the Object array using the given comparator.
|
T
|
min(Closure closure)
Selects the minimum value found from the Object array
using the closure to determine the correct ordering.
|
T[]
|
minus(Collection removeMe)
Create an array composed of the elements of the first array minus the
elements of the given collection.
|
T[]
|
minus(T[] removeMe)
Create an array composed of the elements of the first array minus the
elements of the given array.
|
T[]
|
minus(Object operand)
Create a new object array composed of the elements of the first array
minus the operand.
|
T[]
|
reverse()
Reverse the items in an Object array.
|
T[]
|
reverseEach(Closure closure)
Iterate over each element of the array in the reverse order.
|
T[]
|
sort()
Sorts the given Object array into sorted order.
|
T[]
|
sort(Comparator comparator)
Sorts the given Object array into sorted order using the given comparator.
|
T[]
|
sort(Closure closure)
Sorts the given Object array into a newly created array using
the Closure to determine the correct ordering.
|
List
|
toList()
Allows conversion of arrays into a mutable List.
|
getAt
public List getAt(Collection indices)
-
- Select a List of items from an Object array using a Collection to
identify the indices to be selected.
- Parameters:
indices
- a Collection of indices.
- Returns:
- a new list of the values at the given indices
- Since:
- 1.0
getAt
public List getAt(Range range)
-
- Support the range subscript operator for an Array
- Parameters:
range
- a Range.
- Returns:
- a range of a list from the range's from index up to but not
including the range's to value
- Since:
- 1.0
getAt
public List getAt(IntRange range)
-
- Parameters:
range
- an IntRange.
- Returns:
- a range of a list from the range's from index up to but not
including the range's to value
- Since:
- 1.0
getAt
public List getAt(EmptyRange range)
-
- Parameters:
range
- an EmptyRange.
- Returns:
- an empty Range
- Since:
- 1.5.0
getAt
public List getAt(ObjectRange range)
-
- Parameters:
range
- an ObjectRange.
- Returns:
- a range of a list from the range's from index up to but not
including the range's to value
- Since:
- 1.0
iterator
public Iterator iterator()
-
- Attempts to create an Iterator for the given object by first
converting it to a Collection.
- Returns:
- an Iterator for the given Array.
- Since:
- 1.6.4
- See:
- DefaultTypeTransformation#asCollection(Object[]).
max
public T max()
-
- Adds max() method to Object arrays.
- Returns:
- the maximum value
- Since:
- 1.5.5
- See:
- #max.
max
public T max(Closure closure)
-
- Selects the maximum value found from the Object array
using the closure to determine the correct ordering.
If the closure has two parameters
it is used like a traditional Comparator. I.e. it should compare
its two parameters for order, returning a negative integer,
zero, or a positive integer when the first parameter is less than,
equal to, or greater than the second respectively. Otherwise,
the Closure is assumed to take a single parameter and return a
Comparable (typically an Integer) which is then used for
further comparison.
- Parameters:
closure
- a Closure used to determine the correct ordering.
- Returns:
- the maximum value
- Since:
- 1.5.5
- See:
- #max.
max
public T max(Comparator comparator)
-
- Selects the maximum value found from the Object array using the given comparator.
- Parameters:
comparator
- a Comparator.
- Returns:
- the maximum value
- Since:
- 1.5.5
min
public T min()
-
- Adds min() method to Object arrays.
- Returns:
- the minimum value
- Since:
- 1.5.5
- See:
- #min.
min
public T min(Comparator comparator)
-
- Selects the minimum value found from the Object array using the given comparator.
- Parameters:
comparator
- a Comparator.
- Returns:
- the minimum value
- Since:
- 1.5.5
- See:
- #min.
min
public T min(Closure closure)
-
- Selects the minimum value found from the Object array
using the closure to determine the correct ordering.
If the closure has two parameters
it is used like a traditional Comparator. I.e. it should compare
its two parameters for order, returning a negative integer,
zero, or a positive integer when the first parameter is less than,
equal to, or greater than the second respectively. Otherwise,
the Closure is assumed to take a single parameter and return a
Comparable (typically an Integer) which is then used for
further comparison.
- Parameters:
closure
- a Closure used to determine the correct ordering.
- Returns:
- the minimum value
- Since:
- 1.5.5
- See:
- #min.
minus
public T[] minus(Collection removeMe)
-
- Create an array composed of the elements of the first array minus the
elements of the given collection.
- Parameters:
removeMe
- a Collection of elements to remove.
- Returns:
- an array with the supplied elements removed
- Since:
- 1.5.5
minus
public T[] minus(T[] removeMe)
-
- Create an array composed of the elements of the first array minus the
elements of the given array.
- Parameters:
removeMe
- an array of elements to remove.
- Returns:
- an array with the supplied elements removed
- Since:
- 1.5.5
minus
public T[] minus(Object operand)
-
- Create a new object array composed of the elements of the first array
minus the operand.
- Parameters:
operand
- an element to remove from the array.
- Returns:
- a new array with the operand removed
- Since:
- 1.5.5
reverse
public T[] reverse()
-
- Reverse the items in an Object array.
- Returns:
- an array containing the reversed items
- Since:
- 1.5.5
reverseEach
public T[] reverseEach(Closure closure)
-
- Iterate over each element of the array in the reverse order.
- Parameters:
closure
- a closure to which each item is passed.
- Returns:
- the original array
- Since:
- 1.5.2
sort
public T[] sort()
-
- Sorts the given Object array into sorted order. The array items are
assumed to be comparable.
- Returns:
- the sorted array
- Since:
- 1.5.5
sort
public T[] sort(Comparator comparator)
-
- Sorts the given Object array into sorted order using the given comparator.
- Parameters:
comparator
- a Comparator used for the comparison.
- Returns:
- the sorted array
- Since:
- 1.5.5
sort
public T[] sort(Closure closure)
-
- Sorts the given Object array into a newly created array using
the Closure to determine the correct ordering.
If the closure has two parameters
it is used like a traditional Comparator. I.e. it should compare
its two parameters for order, returning a negative integer,
zero, or a positive integer when the first parameter is less than,
equal to, or greater than the second respectively. Otherwise,
the Closure is assumed to take a single parameter and return a
Comparable (typically an Integer) which is then used for
further comparison.
- Parameters:
closure
- a Closure used to determine the correct ordering.
- Returns:
- the sorted array
- Since:
- 1.5.5
toList
public List toList()
-
- Allows conversion of arrays into a mutable List.
- Returns:
- the array as a List
- Since:
- 1.0